import router from '@ohos.router'

export default {
    data: {
        currentTag: "home",
        tabBarItems: [
            {
                "tag": "home",
                "pagePath": "pages/home/home",
                "iconPath": "common/Icon/icon_home.png",
                "selectedIconPath": "common/Icon/icon_home_active.png",
                "text": ""
            },
            {
                "tag": "category",
                "pagePath": "pages/category/category",
                "iconPath": "common/Icon/icon_category.png",
                "selectedIconPath": "common/Icon/icon_category_active.png",
                "text": ""
            },
            {
                "tag": "cart",
                "pagePath": "pages/cart/cart",
                "iconPath": "common/Icon/icon_cart.png",
                "selectedIconPath": "common/Icon/icon_cart_active.png",
                "text": ""
            },
            {
                "tag": "my",
                "pagePath": "pages/my/my",
                "iconPath": "common/Icon/icon_my.png",
                "selectedIconPath": "common/Icon/icon_my_active.png",
                "text": ""
            }
        ]
    },
    onInit() {
        this.tabBarItems[0].text = this.$t('strings.home')
        this.tabBarItems[1].text = this.$t('strings.category')
        this.tabBarItems[2].text = this.$t('strings.cart')
        this.tabBarItems[3].text = this.$t('strings.my')
    },
    onShow() {
        const params = router.getParams()
        if (params && params.tag) {
            this.currentTag = params.tag
        }
    },
    changePage(tag) {
        this.currentTag = tag
    }
}


